//
//  NSLockViewController.m
//  testpbl
//
//  Created by 黄权浩 on 15/8/25.
//  Copyright (c) 2015年 黄权浩. All rights reserved.
//

#import "NSLockViewController.h"
#import "TopAlertView.h"

@interface NSLockViewController ()

@end

@implementation NSLockViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
//    _changeView.enabled = YES;
//    self.navigationController.navigationBarHidden = YES;
//    [self lock];
//    [[TopAlertView sharestand]initTopview:@"111" withmisstime:2 class:self.view];
//    NSLock *lock = [[NSLock alloc] init];
//    //线程1
//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//        [lock lock];
//        NSLog(@"jjjj");
//        sleep(10);
//        [lock unlock];
//    });
//    
//    //线程2
//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//        sleep(1);
//        [lock lock];
//        NSLog(@"xxxx");
//        [lock unlock];
//    });
}

- (NSLock *)lock
{
    if (!_lock) {
        _lock = [[NSLock alloc] init];
    }
    return _lock;
}

- (IBAction)chgsdwad:(id)sender {
    SecondViewController *second = [[SecondViewController alloc] init];
    [self.navigationController pushViewController:second animated:YES];
}

- (void)changFrame
{
//    [UIView animateWithDuration:3.f animations:^{
//        [_lock lock];
//        _ima.frame = CGRectMake(18, 322, 127, 57);
//    } completion:^(BOOL finished) {
//        [_lock unlock];
//    }];
    SecondViewController *second = [[SecondViewController alloc] init];
    [self.navigationController pushViewController:second animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
@end
